﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hydra.Shell.Interfaces;
using System.Windows.Input;
using Hydra.Shell.Enumerations;
using System.Windows.Controls;
using System.Windows;
using Hydra.Shell.Attributes;
using SLControlLibrary;

namespace Hydra.Shell.Implementations
{
    public abstract class HydraPackage : HydraServiceBase<HydraPackage>, IHydraPackage
    {
        public Guid PackageGuid { get; set; }
        public EventHandler Disposed { get; set; }
        private IQueryServiceProvider serviceProvider;

        public HydraPackage(UIThread uiThread) : base(uiThread)
        {
            var guidAttribute = (GuidAttribute)this.GetType().GetCustomAttributes(true).Single(a => a is GuidAttribute);

            this.PackageGuid = Guid.Parse(guidAttribute.Value);
        }

        protected virtual void Initialize()
        {
        }

        protected virtual void OnLoadOptions(string key, System.IO.Stream stream)
        {
        }

        protected virtual void OnSaveOptions(string key, System.IO.Stream stream)
        {
        }

        protected virtual object GetToolboxItemData(string itemId, string format)
        {
            return null;
        }

        public void SetSite(IQueryServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
            this.Initialize();
        }

        public bool CanClose
        {
            get { throw new NotImplementedException(); }
        }

        public void Close()
        {
            throw new NotImplementedException();
        }

        public virtual IDispatch GetAutomationObject(string propertyName)
        {
            throw new NotImplementedException();
        }

        public void CreateTool(Guid toolID)
        {
            throw new NotImplementedException();
        }

        public void ResetDefaults(PackageResetFlags packageResetFlags)
        {
            throw new NotImplementedException();
        }

        public HydraPropertySheetPage[] GetPropertyPage(Guid page)
        {
            throw new NotImplementedException();
        }
    }
}
